
#格式化输出上三角
def above(n):
    for i in range(1,n):
        for j in range(n,0,-1):
            print("{}".format((len(str(j)) + 1) * ' ' ), end = '') if i < j else print(j,end=' ')
        print()


#累加隔空输出下三角

def below(n):
    blank_iterable = 0
    for i in range(n,0,-1):
        print(blank_iterable * ' ', end='')
        for i in range(n,0,-1):
            print(i,end=' ')
        blank_iterable += (len(str(n)) + 1)
        n = n - 1
        print()


above(22)

below(22)


# 做得不错
